package top.chmin.project.cloud.common.entity.label.value.auto;

// field import auto
// #bind.field.id#

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import top.chmin.project.cloud.common.entity.*;

/**
 * chmin
 * 2023-12-27 15:15:33
 * cloud-builder
 */
@Getter
@Setter
@Accessors(chain = true)
public class EntityLabelValue extends Model {

    // field auto
// #bind.field.tableCode#
    // 实体编码
    private String tableCode;
// $bind.field.tableCode$

    // #bind.field.labelFieldCode#
    // Label属性名称
    private String labelFieldCode;
// $bind.field.labelFieldCode$

    // #bind.field.valueFieldCode#
    // Value属性名称
    private String valueFieldCode;
// $bind.field.valueFieldCode$

    // #bind.field.dataApiType#
    // 适用数据结构
    private String dataApiType;
// $bind.field.dataApiType$


    @Override
    public EntityLabelValueEPC getPreCondition() {
        return new EntityLabelValueEPC();
    }

    public class EntityLabelValueEPC extends PreCondition {
        private EntityLabelValueEPC() {
        }

        private EntityLabelValueEPC(EntityLabelValueEPC parent) {
            super(parent);
        }

        public EntityLabelValueEPC forUpdate() {
            addUpdateSql("update_time = ?", updateTime);
            addUpdateSql("update_by = ?", updateBy);
// field update auto
// #bind.field.tableCode#
            addUpdateSql("table_code = ?", tableCode);
// $bind.field.tableCode$

// #bind.field.labelFieldCode#
            addUpdateSql("label_field_code = ?", labelFieldCode);
// $bind.field.labelFieldCode$

// #bind.field.valueFieldCode#
            addUpdateSql("value_field_code = ?", valueFieldCode);
// $bind.field.valueFieldCode$

// #bind.field.dataApiType#
            addUpdateSql("data_api_type = ?", dataApiType);
// $bind.field.dataApiType$

            type = "UPDATE";
            return this;
        }

        public EntityLabelValueEPC forDelete() {
            type = "DELETE";
            return this;
        }

        public EntityLabelValueEPC forCount() {
            type = "COUNT";
            return this;
        }

        public EntityLabelValueEPC sub() {
            return new EntityLabelValueEPC(this);
        }

        public EntityLabelValueEPC complete(boolean and) {
            finish(and);
            return parent == null ? this : (EntityLabelValueEPC) parent;
        }

        public EntityLabelValueFPC toFlex() {
            EntityLabelValueFPC flex = new EntityLabelValueFPC();
            flex.setUpdateSqlList(updateSqlList);
            flex.setUpdateValueList(updateValueList);
            flex.setSqlList(sqlList);
            flex.setValueList(valueList);
            flex.setType(type);
            return flex;
        }

        public Condition toCondition() {
            return toCondition(EntityLabelValue.class, "bs_entity_label_value");
        }

        // field epc auto
// #bind.field.id#
        public Id id() {
            return new Id();
        }

        // #bind.field.tableCode#
        public TableCode tableCode() {
            return new TableCode();
        }
// $bind.field.id$

        // #bind.field.createBy#
        public CreateBy createBy() {
            return new CreateBy();
        }

        // #bind.field.labelFieldCode#
        public LabelFieldCode labelFieldCode() {
            return new LabelFieldCode();
        }
// $bind.field.createBy$

        // #bind.field.updateBy#
        public UpdateBy updateBy() {
            return new UpdateBy();
        }

        // #bind.field.valueFieldCode#
        public ValueFieldCode valueFieldCode() {
            return new ValueFieldCode();
        }
// $bind.field.updateBy$

        // #bind.field.createTime#
        public CreateTime createTime() {
            return new CreateTime();
        }

        public class Id extends LongEPCField<EntityLabelValueEPC> {
            private Id() {
                super(EntityLabelValueEPC.this, "id", id);
            }
        }
// $bind.field.createTime$

        // #bind.field.updateTime#
        public UpdateTime updateTime() {
            return new UpdateTime();
        }

        public class CreateBy extends StringEPCField<EntityLabelValueEPC> {
            private CreateBy() {
                super(EntityLabelValueEPC.this, "create_by", createBy);
            }
        }
// $bind.field.updateTime$

        public class UpdateBy extends StringEPCField<EntityLabelValueEPC> {
            private UpdateBy() {
                super(EntityLabelValueEPC.this, "update_by", updateBy);
            }
        }

        public class CreateTime extends LocalDateTimeEPCField<EntityLabelValueEPC> {
            private CreateTime() {
                super(EntityLabelValueEPC.this, "create_time", createTime);
            }
        }
// $bind.field.tableCode$

        public class UpdateTime extends LocalDateTimeEPCField<EntityLabelValueEPC> {
            private UpdateTime() {
                super(EntityLabelValueEPC.this, "update_time", updateTime);
            }
        }

        public class TableCode extends StringEPCField<EntityLabelValueEPC> {
            private TableCode() {
                super(EntityLabelValueEPC.this, "table_code", tableCode);
            }
        }
// $bind.field.labelFieldCode$

        public class LabelFieldCode extends StringEPCField<EntityLabelValueEPC> {
            private LabelFieldCode() {
                super(EntityLabelValueEPC.this, "label_field_code", labelFieldCode);
            }
        }

        public class ValueFieldCode extends StringEPCField<EntityLabelValueEPC> {
            private ValueFieldCode() {
                super(EntityLabelValueEPC.this, "value_field_code", valueFieldCode);
            }
        }
// $bind.field.valueFieldCode$

        // #bind.field.dataApiType#
        public DataApiType dataApiType() {
            return new DataApiType();
        }

        public class DataApiType extends StringEPCField<EntityLabelValueEPC> {
            private DataApiType() {
                super(EntityLabelValueEPC.this, "data_api_type", dataApiType);
            }
        }
// $bind.field.dataApiType$

    }
}
